<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .parent{
      width: 300px;
      height: 300px;
      background-color: #ccc;
      /* 水平居中 */
      margin: 0 auto;
      display: flex;
    }
    .parent>div{
      width: 60px;
      height: 60px;
    }
    .parent>div:nth-child(2){
      /* 给弹性元素设置宽度 默认值auto 优先级高于width */
      /* flex-basis: 100px; */
      /* flex:flex-grow flex-shrink flex-basis;简写
        默认值   0 1 auto
      */
      /* flex: 0 0 auto; */
      flex: 1;
    }
    .parent>div:last-child{
      flex: 2;
    }
  </style>
</head>
<body>
  <div class="parent">
    <div class="div1" style="background-color:red;">弹性元素1</div>
    <div class="div2" style="background-color:green;">弹性元素2</div>
    <div class="div3" style="background-color: blue">弹性元素3</div>
  </div>
</body>
</html>